/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
/**
 * Created by hjh on 2017/7/8.
 * 产生随机密码函数
 */

/* eslint-disable */

export default function randPassword (): string {
    let text = ['abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1234567890', '@{}[]()+.?'];
    let rand = (min: number, max: number) => Math.floor(Math.max(min, Math.random() * (max + 1)));
    let len = rand(6, 8); // 长度为8-16
    let pw = '';

    for (let i = 0; i < len; ++i) {
        let strpos = rand(0, 3);
        pw += text[strpos].charAt(rand(0, text[strpos].length));
    }

    return pw;
}
